package biz.ws.receive.client;

import biz.ws.receive.MessageExecutor;
import biz.ws.ws.Message;
import biz.ws.ws.MsgHolder;
import biz.ws.ws.WsCst;
import biz.ws.ws.WsUtils;
import io.netty.channel.ChannelHandlerContext;
import org.springframework.stereotype.Component;

/**
 * @创建人 wsdc
 * @时间 2021/4/2
 * @描述 心跳处理
 */
@Component
public class BeatMessageExecutor implements MessageExecutor {
    @Override
    public void onMessage(MsgHolder context) {
        Message msg = context.getMessage();
        ChannelHandlerContext ctx = context.getCtx();
        WsUtils.write(ctx.channel(),msg);
    }

    @Override
    public String type() {
        return WsCst.MsgType.BEAT;
    }
}
